<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link href="/Show/Admin/Public/css/news.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="/Show/Admin/Public/js/jqselect.js"></script>
    <script type="text/javascript" src="/Show/Admin/Public/js/jquery-3.1.1.min.js"></script>
    {literal}
    <script type="text/javascript">
        $(document).ready(function(){
            $("select").change(function(){
                var id = $(this).attr('fd');
                var state = $(this).val();
                $.post("/Show/Index.php/Admin/News/state_change",{news_id:id,state:state},function(data){
                    if(data){
                        alert(data);
                    }
                });
            });
        });
    </script>
    {/literal}
    <title>新闻列表</title>
  </head>
  <body>
    <div class="mainbox">
          <div class="tablebox">
            <table class="table" >
              <tr class="one">
                <td>ID</td>
                <td><span class="span three">标题</span></td>
                <td>作者</td>
                <td>直属栏目</td>
                <td>发表时间</td>
                <td>操作</td>
              </tr>
            {if $list}
             {section name=n loop=$list}
              <tr>
                <td>{$list[n].id}</td>
                <td>
                    <span class="span three">{$list[n].title|replace:$contents:"<font color='red'>$contents</font>"}</span>
                    <font color="red">
                    {if $list[n].picture!=""}图片&nbsp;{/if}
                    {if $list[n].index_round==1}首页轮播&nbsp;{/if}
                    {if $list[n].news_round==1}新闻页轮播&nbsp;{/if}
                    </font>
                </td>
                <td>{$list[n].author}</td>
                <td>
                    {section name=z loop=$zlist}
                    {if $list[n].n_id==$zlist[z].id}
                    {$zlist[z].name}
                    {/if}
                    {/section}
                </td>
                <td>{$list[n].time|date_format:"%Y-%m-%d %H:%M:%S"}</td>
                <td>
                    <select name='state' fd="{$list[n].id}">
                        <option value='0' {if $list[n].state==0} selected='selected' {/if}>待审核</option>
                        <option value='1' {if $list[n].state==1} selected='selected' {/if}>已审核</option>
                        <option value='2' {if $list[n].state==2} selected='selected' {/if}>退稿</option>
                    </select>
                    <a href="#" onclick="if(confirm('确定删除？'))location.href='{$smarty.const.__CONTROLLER__}/delete/id/{$list[n].id}';"><img src="/Show/Admin/Public/image/del.jpg" class="pit" title="删除"></a>
                    <a href="#" onclick="location.href='{$smarty.const.__CONTROLLER__}/xiugai/id/{$list[n].id}'" ><img src="/Show/Admin/Public/image/edi.jpg" class="pit" title="编辑"></a>
                </td>
              </tr>
              {/section}
              {else}
              <tr>
              <td colspan="7">搜索不到与&nbsp;'<font color='blue' size='4'>{$contents}</font>'&nbsp;相关的标题</td>
              </tr>
             {/if}
            </table>
          </div>
          <div class="page">
           {$page}
          </div>
    </div>
  </body>
</html>